package com.xcity.game.arena.offline;

import naga.x.game.template.Template;
import naga.x.game.template.TemplateException;
import naga.x.game.template.annotation.Excel;

/**
 * 离线竞技场每日奖励
 * @author yang.li
 *
 */
@Excel(value = "arena.xlsx", sheet = 0)
public class ArenaDailyRewardTemplate extends Template {

	/** 起始排名 */
	protected int rankingFrom;

	/** 结束排名 */
	protected int rankingTo;

	/** 奖励荣誉 */
	protected int honor;

	/** 奖励现金 */
	protected int gold;

	public int getRankingFrom() {
		return rankingFrom;
	}

	public void setRankingFrom(int rankingFrom) {
		this.rankingFrom = rankingFrom;
	}

	public int getRankingTo() {
		return rankingTo;
	}

	public void setRankingTo(int rankingTo) {
		this.rankingTo = rankingTo;
	}

	public int getHonor() {
		return honor;
	}

	public void setHonor(int honor) {
		this.honor = honor;
	}

	public int getGold() {
		return gold;
	}

	public void setGold(int gold) {
		this.gold = gold;
	}


	@Override
	public void validate() throws TemplateException {
		// 修正排名（配置从1开始，程序使用从0开始）
		if (--rankingFrom < 0) {
			throw new TemplateException("离线竞技场每日奖励排名配置错误: rankingFrom=" + (rankingFrom - 1));
		}
		if (--rankingTo < 0) {
			throw new TemplateException("离线竞技场每日奖励排名配置错误: rankingTo=" + (rankingTo - 1));
		}
		if (rankingTo < rankingFrom) {
			throw new TemplateException("离线竞技场每日奖励排名配置错误: rankingFrom=" + (rankingFrom - 1) + ", rankingTo=" + (rankingTo - 1));
		}
	}
}
